using System;
using System.Linq;
using System.ComponentModel;

namespace DotNetExtensions.AspNet.DevExpress.MVVM.ViewModels
{
    public enum EntityMessageType
    {
        Added,
        Deleted,
        Changed
    }

    public class EntityMessage<TEntity, TPrimaryKey>
    {

        public EntityMessage(TPrimaryKey primaryKey, EntityMessageType messageType)
        {
            this.PrimaryKey = primaryKey;
            this.MessageType = messageType;
        }

        public TPrimaryKey PrimaryKey { get; private set; }

        public EntityMessageType MessageType { get; private set; }
    }

    public class SaveAllMessage
    {
    }

    public class CloseAllMessage
    {
        private readonly CancelEventArgs cancelEventArgs;

        public CloseAllMessage(CancelEventArgs cancelEventArgs)
        {
            this.cancelEventArgs = cancelEventArgs;
        }


        public bool Cancel
        {
            get { return cancelEventArgs.Cancel; }
            set { cancelEventArgs.Cancel = value; }
        }
    }

    public class DestroyOrphanedDocumentsMessage { }

    public class NavigateMessage<TNavigationToken>
    {

        public NavigateMessage(TNavigationToken token)
        {
            Token = token;
        }

        public TNavigationToken Token { get; private set; }
    }

    public class DocumentShownMessage
    {
        public DocumentShownMessage(string documentType)
        {
            DocumentType = documentType;
        }

        public string DocumentType { get; set; }
    }
}
